
 <?php 
  require_once('inc_admin.php');
  //连接数据库  
  connect();
  //编写sql语句
  $sql = "select sqh_id, sqh_title, sqh_pic, sqh_place,sqh_intro, sqh_adddate, sqh_hint  from flower";

  //如果用户提交了表单，则获取用户输入的关键字
  if($_POST['key'])  {
    $key = trim($_POST['key']);
    $sql = $sql." where sqh_title like '%{$key}%' ";
  }
  
  //echo $sql.'<br/>';  
  $result = fetch_array($sql);    
 ?>
<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>

 <center><h3>鲜花列表</h3></center>
 <table align="center" width="80%" border=1> 
 <tr>
   <th>鲜花标题</th>
   <th width="80">鲜花图片</th>   
   <th>鲜花产地</th>
   <th>鲜花简介</th>
   <th>鲜花添加时间</th>
   <th>点击量</th> 
 </tr>

 <?php
  foreach ($result as $row) {
   echo '<tr>';
   
  echo "<td><a href='detail.php?id=".$row['sqh_id']."'>".$row['sqh_title']."</a></td>";
   
   echo '<td align="center"><img src='.$row['sqh_pic'].' width=60 height=80 alt="无头像"></td>';  
   
   echo '<td>'.$row['sqh_place'].'</td>';
   echo '<td>'.$row['sqh_intro'].'</td>';
  
   echo '<td>'.$row['sqh_adddate'].'</td>';    
     
   echo '<td>'.$row['sqh_hint'].'</td>';
   echo '<td><a href="">修改</a> |
   <a href="fDelete.php?id='.$row['sqh_id'].' " onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';

   echo '</tr>';  
  }

  echo '</table>';  
  
 ?>
 
</body>
</html>
 

 

 


